package com.jackchen.common.i18n;

/**
 * 服务器每次接收request时，将发送此次request的用户的语言标识设置到langFlag中
 * 留待hibernate的ModelString容器在实例化模型时使用
 */
public class UserLocaleCache {

	public static final UserLocaleCache instance = new UserLocaleCache();
	private ThreadLocal<String> langFlag = new ThreadLocal<String>();
	
	private UserLocaleCache () {
		
	}
	
	public static final UserLocaleCache getInstance() {
		return instance;
	}

	public String getLangFlag() {
		return langFlag.get();
	}

	public void setLangFlag(String langFlag) {
		this.langFlag.set(langFlag);
	}
	
	public void reset() {
		this.langFlag.remove();
	}
}
